/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Damian
 */
@Entity
@Table(name = "offer_images")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OfferImages.findAll", query = "SELECT o FROM OfferImages o"),
    @NamedQuery(name = "OfferImages.findByIdOfferImage", query = "SELECT o FROM OfferImages o WHERE o.idOfferImage = :idOfferImage"),
    @NamedQuery(name = "OfferImages.findBySrcimage", query = "SELECT o FROM OfferImages o WHERE o.srcimage = :srcimage")})
public class OfferImages implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_OFFER_IMAGE")
    private Integer idOfferImage;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "SRCIMAGE")
    private String srcimage;
    @JoinColumn(name = "ID_OFFER", referencedColumnName = "ID_OFFER")
    @ManyToOne(optional = false)
    private Offer idOffer;

    public OfferImages() {
    }

    public OfferImages(Integer idOfferImage) {
        this.idOfferImage = idOfferImage;
    }

    public OfferImages(Integer idOfferImage, String srcimage) {
        this.idOfferImage = idOfferImage;
        this.srcimage = srcimage;
    }

    public Integer getIdOfferImage() {
        return idOfferImage;
    }

    public void setIdOfferImage(Integer idOfferImage) {
        this.idOfferImage = idOfferImage;
    }

    public String getSrcimage() {
        return srcimage;
    }

    public void setSrcimage(String srcimage) {
        this.srcimage = srcimage;
    }

    public Offer getIdOffer() {
        return idOffer;
    }

    public void setIdOffer(Offer idOffer) {
        this.idOffer = idOffer;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOfferImage != null ? idOfferImage.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OfferImages)) {
            return false;
        }
        OfferImages other = (OfferImages) object;
        if ((this.idOfferImage == null && other.idOfferImage != null) || (this.idOfferImage != null && !this.idOfferImage.equals(other.idOfferImage))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.OfferImages[ idOfferImage=" + idOfferImage + " ]";
    }
    
}
